<?php

/**
 * PaymentCard form base class.
 *
 * @package    form
 * @subpackage payment_card
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BasePaymentCardForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'payment_id' => new sfWidgetFormDoctrineChoice(array('model' => 'Payment', 'add_empty' => true)),
      'card_id'    => new sfWidgetFormDoctrineChoice(array('model' => 'CardCompany', 'add_empty' => false)),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorDoctrineChoice(array('model' => 'PaymentCard', 'column' => 'id', 'required' => false)),
      'payment_id' => new sfValidatorDoctrineChoice(array('model' => 'Payment', 'required' => false)),
      'card_id'    => new sfValidatorDoctrineChoice(array('model' => 'CardCompany')),
      'created_at' => new sfValidatorDateTime(array('required' => false)),
      'updated_at' => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('payment_card[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'PaymentCard';
  }

}
